<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /*
         盒子的总宽度: 
           width = content[width[自己设置的]] + padding-left/right + border-left/right
        
           width 自己设置 = content[width[auto]] + padding-left/right + border-left/right
           */
        .a {
             width: 500px;
             padding:0 60px;
             border-left: solid  30px;
             border-right: solid 50px;
             height: 100px;
             background-color: red;
             /* 默认 width 就是内容区的宽度*/
             box-sizing: content-box;
             /*  width 就是整个盒子的宽度*/
             box-sizing: border-box;
        }
        .b {
            width: 300px;
             padding:0 50px;
             border-left: solid  50px;
             border-right: solid 50px;
             height: 100px;
             background-color: red;
        }
    </style>
</head>
<body>
    
    <div class="a">xxxx</div>
    <hr>
    <div class="b">xxx</div>
</body>
</html>